import sys

def svm2double(inpath, outpath):
    fin = open(inpath,'r')
    fout = open(outpath,'w')
    for line in fin:
        if line.find(' ') == -1: #skip this line
            continue 
        s,f = line.split(' ',1)
        flist = f.split()
        for pair in flist:
            if pair.find(':') == -1:
                continue
            index,value = pair.split(':')
            fout.write(value)
            fout.write(' ')
        fout.write('\n')
    fin.close()
    fout.close()

if __name__=='__main__':
    if len(sys.argv) < 3:
        print 'usage:',sys.argv[0],'<input>','<output>'
        sys.exit()
    svm2double(sys.argv[1],sys.argv[2])
